//
// Created by xili on 2024/8/13 20:50.
// GO BIG OR GO HOME.
//
#include "leetcode.h"

class Solution {
public:
    double minimumAverage(vector<int> &nums) {
        int ans = INT32_MAX;
        sort(nums.begin(), nums.end());
        int n = nums.size();
        int l = 0, r = n - 1;
        while (l < r) {
            ans = min(ans, nums[l++] + nums[r--]);
        }
        return ans / 2.0;
    }
};